#ifndef MOUSE_EVENT_AGGREGATORS
#define MOUSE_EVENT_AGGREGATORS

#include "OglViewInterfaces.h"

#include <vector>

class MouseEventAggCondEval: public ICustomOnMouse
{
	std::vector<ICustomOnMouse *> m_vectorWorkers;
public:
	MouseEventAggCondEval(void);
	virtual ~MouseEventAggCondEval(void);

	void PushSubHandler(ICustomOnMouse & subHandler)
	{
		m_vectorWorkers.push_back(&subHandler);
	}

	ICustomOnMouse * PopSubHandler()
	{
		ICustomOnMouse * pRetVal = m_vectorWorkers.back();
		m_vectorWorkers.pop_back();
		return pRetVal;
	}

	virtual bool OnMouseMove(UINT nFlags, double lfX, double lfY )
	{
		bool bRetVal = false;

		std::vector<ICustomOnMouse *>::iterator iter = 
			m_vectorWorkers.begin();
		for(; !bRetVal && iter != m_vectorWorkers.end(); ++iter)
		{
			bRetVal = (*iter)->OnMouseMove(nFlags, lfX, lfY);
		}
		return bRetVal;
	}
};

class MouseEventAggUncondEval: public ICustomOnMouse
{
	std::vector<ICustomOnMouse *> m_vectorWorkers;
public:
	MouseEventAggUncondEval(void);
	virtual ~MouseEventAggUncondEval(void);

	void PushSubHandler(ICustomOnMouse & subHandler)
	{
		m_vectorWorkers.push_back(&subHandler);
	}

	ICustomOnMouse * PopSubHandler()
	{
		ICustomOnMouse * pRetVal = m_vectorWorkers.back();
		m_vectorWorkers.pop_back();
		return pRetVal;
	}

	virtual bool OnMouseMove(UINT nFlags, double lfX, double lfY )
	{
		bool bRetVal = false;

		std::vector<ICustomOnMouse *>::iterator iter = 
			m_vectorWorkers.begin();
		for(; iter != m_vectorWorkers.end(); ++iter)
		{
			bRetVal = (*iter)->OnMouseMove(nFlags, lfX, lfY) || bRetVal;
		}
		return bRetVal;
	}
};

#endif